package nio;

import java.nio.IntBuffer;
import java.util.Arrays;

/**
 * @Author Klys
 * @Date 2023/6/3 10:40
 * @Description
 * @Version 1.0
 */
public class Demo03 {

    public static void main(String[] args) {
        IntBuffer buffer = IntBuffer.allocate(10);
        int[] arr = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9};
        buffer.put(arr, 3, 4);  //从下标3开始，截取4个元素

        int[] array = buffer.array();
        System.out.println(array);

        System.out.println(Arrays.toString(buffer.array()));  //array方法可以直接获取到数组
    }
}
